package com.ruoyi.his.controller;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.his.domain.HisDepartment;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.his.domain.HisOutpatientQueue;
import com.ruoyi.his.service.IHisOutpatientQueueService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 患者队列表Controller
 * 
 * @author ruoyi
 * @date 2021-11-07
 */
@RestController
@RequestMapping("/his/mz")
public class HisOutpatientQueueController extends BaseController
{
    @Autowired
    private IHisOutpatientQueueService hisOutpatientQueueService;


    /**
     * 修改挂号收费
     */
    @PostMapping(value = "/updateQueueStatus")
    public AjaxResult updateQueueStatus(@RequestBody Map data)
    {
        return toAjax(hisOutpatientQueueService.updateQueueStatus(data));
    }








    @PostMapping(value = "/queryOutpatientQueueByUserId/{userId}")
    public TableDataInfo selectDoctorByDepartment(@PathVariable String userId)
    {
        startPage();
        SysUser user = SecurityUtils.getLoginUser().getUser();



            userId = user.getUserId()+"";


        List<Map<String, Object>> list = hisOutpatientQueueService.queryOutpatientQueueByUserId(userId);
        return getDataTable(list);

    }


    /**
     * 获取就诊卡号获取病人详细信息
     */
    @PostMapping(value = "/getPatientInfoByCardId/{cardId}")
    public AjaxResult getInfo(@PathVariable("cardId") String cardId)
    {
        return AjaxResult.success(
                hisOutpatientQueueService.queryHisPatientByCardId(cardId)
        );
    }



    /**
     * 修改挂号收费
     */
    @PostMapping(value = "/editInfo")
    public AjaxResult edit(@RequestBody Map data)
    {
        return toAjax(hisOutpatientQueueService.updataOutpatientInfo(data));
    }














}
